/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vfi.be;

import edu.upn.sigemfi.ope.be.Moneda;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "VFI_SALDO_CAJA")
@NamedQueries({@NamedQuery(name = "SaldoCaja.findAll", query = "SELECT s FROM SaldoCaja s"), @NamedQuery(name = "SaldoCaja.findByIdSaldoCaja", query = "SELECT s FROM SaldoCaja s WHERE s.idSaldoCaja = :idSaldoCaja"), @NamedQuery(name = "SaldoCaja.findByMonto", query = "SELECT s FROM SaldoCaja s WHERE s.monto = :monto"), @NamedQuery(name = "SaldoCaja.findByMontoAndCaja", query = "SELECT s FROM SaldoCaja s WHERE s.monto = :monto and s.fidVfiCaja = :fidVfiCaja")})
public class SaldoCaja implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_SALDO_CAJA", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idSaldoCaja;
    @Column(name = "MONTO", precision = 53)
    private Double monto;
    @JoinColumn(name = "FID_VFI_CAJA", referencedColumnName = "ID_CAJA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Caja fidVfiCaja;
    @JoinColumn(name = "FID_OPE_MONEDA", referencedColumnName = "ID_MONEDA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Moneda fidOpeMoneda;

    public SaldoCaja() {
    }

    public SaldoCaja(Long idSaldoCaja) {
        this.idSaldoCaja = idSaldoCaja;
    }

    public Long getIdSaldoCaja() {
        return idSaldoCaja;
    }

    public void setIdSaldoCaja(Long idSaldoCaja) {
        this.idSaldoCaja = idSaldoCaja;
    }

    public Double getMonto() {
        return monto;
    }

    public void setMonto(Double monto) {
        this.monto = monto;
    }

    public Caja getFidVfiCaja() {
        return fidVfiCaja;
    }

    public void setFidVfiCaja(Caja fidVfiCaja) {
        this.fidVfiCaja = fidVfiCaja;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSaldoCaja != null ? idSaldoCaja.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SaldoCaja)) {
            return false;
        }
        SaldoCaja other = (SaldoCaja) object;
        if ((this.idSaldoCaja == null && other.idSaldoCaja != null) || (this.idSaldoCaja != null && !this.idSaldoCaja.equals(other.idSaldoCaja))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.SaldoCaja[idSaldoCaja=" + idSaldoCaja + "]";
    }

    /**
     * @return the fidOperMoneda
     */
    public Moneda getFidOpeMoneda() {
        return fidOpeMoneda;
    }

    /**
     * @param fidOperMoneda the fidOperMoneda to set
     */
    public void setFidOpeMoneda(Moneda fidOpeMoneda) {
        this.fidOpeMoneda = fidOpeMoneda;
    }
}
